package com.example.administrator.zhjt.bean;

import android.content.ContentValues;
import android.database.Cursor;

import com.example.administrator.zhjt.db.EnvironmentDB;

import java.util.List;

/**
 * Created by Administrator on 2017/5/16 0016.
 */

public class Environment {

    private String temperature;
    private String humidity;
    private String lightIntensity;
    private String co2;
    private String pm;
    private String balabce;

    public String getTemperature() {
        return temperature;
    }

    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }

    public String getHumidity() {
        return humidity;
    }

    public void setHumidity(String humidity) {
        this.humidity = humidity;
    }

    public String getLightIntensity() {
        return lightIntensity;
    }

    public void setLightIntensity(String lightIntensity) {
        this.lightIntensity = lightIntensity;
    }

    public String getCo2() {
        return co2;
    }

    public void setCo2(String co2) {
        this.co2 = co2;
    }

    public String getPm() {
        return pm;
    }

    public void setPm(String pm) {
        this.pm = pm;
    }

    public String getBalabce() {
        return balabce;
    }

    public void setBalabce(String balabce) {
        this.balabce = balabce;
    }

    public Environment fromCursor(Cursor cursor){
        Environment environment=null;
        if (cursor!=null){
            environment=new Environment();
            environment.setTemperature(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_TEMPERATURE)));
            environment.setHumidity(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_HUMIDITY)));
            environment.setLightIntensity(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_LIGHTINTENSITY)));
            environment.setCo2(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_CO2)));
            environment.setPm(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_PM)));
            environment.setBalabce(cursor.getString(cursor.getColumnIndex(EnvironmentDB.KEY_BALANCE)));
        }
        return environment;
    }

    public ContentValues fromContentValues(){
        ContentValues contentValues=new ContentValues();
        contentValues.put(EnvironmentDB.KEY_TEMPERATURE,getTemperature());
        contentValues.put(EnvironmentDB.KEY_HUMIDITY,getHumidity());
        contentValues.put(EnvironmentDB.KEY_LIGHTINTENSITY,getLightIntensity());
        contentValues.put(EnvironmentDB.KEY_CO2,getCo2());
        contentValues.put(EnvironmentDB.KEY_PM,getPm());
        contentValues.put(EnvironmentDB.KEY_BALANCE,getBalabce());
        return contentValues;
    }

}
